from django.conf.urls.defaults import *
from django.core.urlresolvers import reverse
from to2.models import Locomotive

locomotive_list_dict = {        'queryset' : Locomotive.objects.all(),
                             'allow_empty' : True,
                             'paginate_by' : 20}

#hjkhlkjh

urlpatterns = patterns('django.views.generic',
    url(r'^$','list_detail.object_list',locomotive_list_dict,name='locomotive_list')
)

locomotive_detail_dict = {
                                'queryset' : Locomotive.objects.all()
}

urlpatterns += patterns('django.views.generic',
    url(r'^(?P<object_id>[0-9]*)/$','list_detail.object_detail',
        locomotive_detail_dict, name='locomotive_detail')
)

locomotive_delete_dict = {               'model' : Locomotive,
                          'post_delete_redirect' : '/locomotive/'
}

urlpatterns += patterns('django.views.generic',
    url(r'^(?P<object_id>[0-9]*)/delete/$', 'create_update.delete_object',
        locomotive_delete_dict, name='locomotive_delete')
)

locomotive_create_dict = {               'model' : Locomotive,
                            'post_save_redirect' : '/locomotive/'
}

urlpatterns += patterns('django.views.generic',
    url(r'^add/$','create_update.create_object',
        locomotive_create_dict, name='locomotive_create')
)

urlpatterns += patterns('django.views.generic',
    url(r'^(?P<object_id>[0-9]*)/update/$', 'create_update.update_object',
        locomotive_create_dict, name='locomotive_update')
)

urlpatterns += patterns('',
    (r'(?P<locomotive_id>[0-9]*)/journal/', include('py.to2.urls.locomotive.journal.urls'))
)